<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>用户登录</title>
    <link rel="stylesheet" href="./css/login.css" type="text/css">
</head>
<body>
    <div class="container">
        <h2>用户登录</h2>
        <% if (request.getAttribute("errorMessage") != null) { %>
            <div class="message error-message">
                <%= request.getAttribute("errorMessage") %>
            </div>
        <% } %>
        
        <% if (request.getParameter("message") != null && request.getParameter("message").equals("loggedOut")) { %>
            <div class="message info-message">
                您已成功退出登录！
            </div>
        <% } %>
        
        <% if (request.getParameter("error") != null && request.getParameter("error").equals("notLoggedIn")) { %>
            <div class="message error-message">
                请先登录后再访问！
            </div>
        <% } %>
        
        <form action="login" method="post">
            <div class="form-group">
                <label for="username">用户名:</label>
                <input type="text" id="username" name="username" required>
            </div>
            
            <div class="form-group">
                <label for="password">密码:</label>
                <input type="password" id="password" name="password" required>
            </div>
            
            <button type="submit" class="btn">登录</button>
        </form>
        
        <div class="links">
            <p><a href="register.jsp">注册账户</a> | <a href="forgotPassword.jsp">忘记密码</a></p>
        </div>
    </div>
</body>
</html>

